﻿<Window
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
  xmlns:local="clr-namespace:TimersXP.ViewModels"
  xmlns:views="clr-namespace:TimersXP.Views"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" 
  x:Class="TimersXP.TimersHost"
  x:Name="TimersHostView"
  SizeToContent="Height"
  Title="TimersXP"
  WindowStartupLocation="CenterScreen"
  WindowStyle="ToolWindow"
  DataContext="TimersHost" d:DesignWidth="704">
    <!--Only needed if we use the c:ArrayList for re-using menus as detailed below, to be added above if used. Needs more research into how to make it work correctly.-->
    <!--xmlns:c="clr-namespace:System.Collections;assembly=mscorlib"-->
    <Window.Resources>
        <ObjectDataProvider x:Key="TimersHost" ObjectType="{x:Type local:TimersHost}" IsAsynchronous="True"/>
        <!--<c:ArrayList x:Key="SkinsCommonMenu" x:Shared="False">
            -->
        <!--This is for a RE-Usable Menu, but it is one level off, need to investigate how to make it one more level up, because using it requires we put another MenuItem-->
        <!--
            <MenuItem Name="ContextMenuSkins1" Header="_Skins" ItemsSource="{Binding Source={StaticResource TimersHost}, Path=Skins}" Style="{DynamicResource styleBanner}">
                <MenuItem.ItemContainerStyle>
                    <Style TargetType="MenuItem">
                        <Setter Property="Header" Value="{Binding Path=SkinName}"/>
                        <Setter Property="Command" Value="{Binding Source={StaticResource TimersHost}, Path=TimersHostContextMenuClickCommand}"/>
                        <Setter Property="CommandParameter" Value="{Binding Path=SkinName}"/>
                        <Setter Property="ItemContainerStyle" Value="{DynamicResource styleBanner}"/>
                    </Style>
                </MenuItem.ItemContainerStyle>
            </MenuItem>
        </c:ArrayList>-->
    </Window.Resources>

    <!-- CONTEXT MENU -->
    <Window.ContextMenu>
        <ContextMenu DataContext="TimersHost" x:Name="TimersHostContextMenu" Style="{DynamicResource styleBanner}">
            <!--This is for a RE-Usable Menu, but it is one level off, need to investigate how to make it one more level up, because using it requires we put another MenuItem-->
            <!--<MenuItem ItemsSource="{StaticResource SkinsCommonMenu}"/>-->
            <!--The above line of code would replace the following Menu Item so we could reuse it, but it means using/declaring an extra Menu Item which isn't what we want.-->
            <MenuItem x:Name="ContextMenuSkins1" Header="_Skins" ItemsSource="{Binding Skins, Source={StaticResource TimersHost}}" Style="{DynamicResource styleBanner}">
                <MenuItem.ItemContainerStyle>
                    <Style TargetType="{x:Type MenuItem}">
                        <Setter Property="Header" Value="{Binding SkinName}"/>
                        <Setter Property="Command" Value="{Binding TimersHostContextMenuClickCommand, Source={StaticResource TimersHost}}"/>
                        <Setter Property="CommandParameter" Value="{Binding SkinName}"/>
                        <Setter Property="ItemContainerStyle" Value="{DynamicResource styleBanner}"/>
                    </Style>
                </MenuItem.ItemContainerStyle>
            </MenuItem>
            <MenuItem x:Name="ContextMenuSettings" Header="_Settings" Style="{DynamicResource styleBanner}">
                <MenuItem x:Name="ContextMenuSkins2" Header="_Skins" ItemsSource="{Binding Skins, Source={StaticResource TimersHost}}" Style="{DynamicResource styleBanner}">
                    <MenuItem.ItemContainerStyle>
                        <Style TargetType="{x:Type MenuItem}">
                            <Setter Property="Header" Value="{Binding SkinName}"/>
                            <Setter Property="Command" Value="{Binding TimersHostContextMenuClickCommand, Source={StaticResource TimersHost}}"/>
                            <Setter Property="CommandParameter" Value="{Binding SkinName}"/>
                            <Setter Property="ItemContainerStyle" Value="{DynamicResource styleBanner}"/>
                        </Style>
                    </MenuItem.ItemContainerStyle>
                </MenuItem>
                <MenuItem x:Name="ContextMenuOptions" Header="_Options" Style="{DynamicResource styleBanner}"/>
            </MenuItem>
            <MenuItem x:Name="ContextMenuHelp" Header="_Help" Style="{DynamicResource styleBanner}">
                <MenuItem x:Name="ContextMenuAbout" Header="_About TimersXP" Style="{DynamicResource styleBanner}"/>
            </MenuItem>
        </ContextMenu>
    </Window.ContextMenu>

    <Grid DataContext="{Binding Source={StaticResource TimersHost}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="21"/>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="90"/>
        </Grid.ColumnDefinitions>

         <!--MAIN MENU--> 
        <Menu IsMainMenu="True" Style="{DynamicResource styleBanner}" Margin="0,0,0,1">
            <MenuItem x:Name="MainMenuSettings" Header="_Settings" Style="{DynamicResource styleBanner}">
                <MenuItem DataContext="TimersHost" x:Name="MainMenuSkins" Header="Skins" ItemsSource="{Binding Skins, Source={StaticResource TimersHost}}" Style="{DynamicResource styleBanner}">
                    <MenuItem.ItemContainerStyle>
                        <Style TargetType="{x:Type MenuItem}">
                            <Setter Property="Header" Value="{Binding SkinName}"/>
                            <Setter Property="Command" Value="{Binding TimersHostContextMenuClickCommand, Source={StaticResource TimersHost}}"/>
                            <Setter Property="CommandParameter" Value="{Binding SkinName}"/>
                            <Setter Property="ItemContainerStyle" Value="{DynamicResource styleBanner}"/>
                        </Style>
                    </MenuItem.ItemContainerStyle>
                </MenuItem>
                <MenuItem x:Name="MainMenuOptions" Header="_Options" Style="{DynamicResource styleBanner}"/>
            </MenuItem>
            <MenuItem x:Name="MainMenuHelp" Header="_Help" Style="{DynamicResource styleBanner}">
                <MenuItem x:Name="MainMenuAbout" Header="_About TimersXP" Style="{DynamicResource styleBanner}"/>
            </MenuItem>
        </Menu>

         <!--TOP MOST CHECK BOX--> 
        <CheckBox x:Name="TomMostCheckBox" Content="Top Most" Grid.Column="1" Height="16" Margin="0,2,0,0"
			HorizontalAlignment="Center" VerticalAlignment="Center" Style="{DynamicResource styleContentArea}"
			Command="{Binding TimersHostTopMostClickCommand, Source={StaticResource TimersHost}}"
			CommandParameter="{Binding}"
			IsChecked="{Binding TopMostChecked, Source={StaticResource TimersHost}}"/>

        <!--Stopwatch & Countdown Tab Defintions-->
        <TabControl Grid.Row="1" Grid.ColumnSpan="2" Style="{DynamicResource styleContentArea}">
            <TabItem Header="Stopwatch">
                <views:Countdown/>
            </TabItem>
            <TabItem Header="Countdown">
                <views:Countdown/>
            </TabItem>
        </TabControl>
    </Grid>
</Window>